import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GTextArea } from "../../../../../com/mui/controls/GTextArea";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { SWFInfo } from "../../../../../com/gengine/resource/info/SWFInfo";
import { ChristmasActivitiesInfo } from "../../../model/ChristmasActivitiesInfo";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
type int = number;
//class ChristmasDesPanel
    
    export  class ChristmasDesPanel /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._width = arg1;
            this._height = arg2;
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._bg = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg.width = this._width;
            this._bg.height = this._height - 25;
            this._bg.x = 0;
            this._bg.y = 25;
            addChild(this._bg);
            LoaderManager.instance.load("ChristmasActiveDesImg.swf", this.onDesImgLoaded);
            this._tf = new GTextFormat(FontUtil.songtiName, 12, GlobalStyle.color1Uint, null, null, null, null, null, flash.text.TextFormatAlign.LEFT, null, null, null, 4);
            this._infoTxt = new GTextArea();
            this._infoTxt.styleName = "GTextArea";
            this._infoTxt.wordWrap = true;
            this._infoTxt.textField.defaultTextFormat = this._tf;
            this._infoTxt.textField.selectable = false;
            this._infoTxt.editable = false;
            this._infoTxt.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._infoTxt.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._infoTxt.x = this._bg.x + 4;
            this._infoTxt.y = this._bg.y + 4;
            this._infoTxt.width = this._bg.width - 8;
            this._infoTxt.height = this._bg.height - 8;
            addChild(this._infoTxt);
            return;
        }

        /* internal  */onDesImgLoaded(arg1: SWFInfo): void
        {
            if (arg1 && arg1.clip) 
            {
                arg1.clip.x = (this.width - arg1.clip.width) / 2;
                addChild(arg1.clip);
            }
            return;
        }

        public updateData(arg1: ChristmasActivitiesInfo): void
        {
            this._info = arg1;
            this._infoTxt.textField.defaultTextFormat = this._tf;
            this._infoTxt.htmlText = HTMLUtil.addColor(arg1.des, GlobalStyle.color1);
            return;
        }

        public dispose(): void
        {
            this._info = null;
            this._infoTxt.text = "";
            return;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_height: int;

        /* internal */ /* var */_info: ChristmasActivitiesInfo;

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_infoTxt: GTextArea;

        /* internal */ /* var */_tf: Object /* flash.text.TextFormat */;
    }
